home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / prog_gen / ada_tutr.zip / LEDIT.ANS (.png) < prev    next >
ANSI Art File  |  1994-08-22  |  7KB  |  640x3152
Labels: text | screenshot | menu | black and white | font
OCR: with Text_DU ase Text_101 codure Ledit is Max_Length ! constant == 001 Haxx_Line Ruaaber ! constant == 29_399: tape Bext is record Les 2 Integer panne . .. Max_Length :s 0; Mal : Stringti .. Max_Length1; est rocerd: luge P is access Linki type Lisk Is record 1 Positive! Line 1 Text: Pts meu Link: : File_Type: Output_File File_Types Texti Finished Line Jan Boolean Is False] Matural 1= 304 function Str(T : Im Text) return String Is separated procedure Read_Input_File Is separate: rocedure be_Connand Is separate: Tutt'lapat file: "); Get_Line( Input, Mel, laput.leml; Read Input Filei Putt Output file! Di Get Line(Input,Val, Input.Lew): Create(Output_File, Mane #> StriInputPPI Get and process connands. while mat Finished loop Put("> "J: Get_LimetEmpat.Wal, Input. Low3: Do_Connand: Write the output file. Temp ER Head Reali Ship amused link at start of linked list. while Temp /s mell loop Live Datpet_File, Strifemp. Line ?? i - Write line of text. Temp Is Temp. Mext! = Gef next Ilsk. Close Output_Filek! Md Ledit: eparate Cladit) begin unction Str(T : in Text) return String Is Pelure T.Malt1 .. T. Leab; M Stri separate Clodit] procedure Bead_Input_File is begin If the input file exists. display a message and read it la. Opeat Ispat_File, In_File, Str(Inpath): Put_Line('Tile found. "); Temp =" Head: Get_Livetlegat_File, Toput Dal, Inget, Lea); Temp Rest is new Link' (Live Min, Inget, 11); Read a Line. Temp I# Temp.Mexli fuld to List. Line Jun 18 Line Mon . 10 Slunce polster to next lisk. ClouetIspat_File !! exception If the Input file doesn't exist, just display a nexxage. ma Mane_Error "} Put_Limet'Tile not found. d_Ispat_File: separate Cladit) procedure Do_Connand_is procedure Delete_First Character(T : In out Text) is separate; procedure fet Leading_fateger ON ; out Natural) Is separatei procedure Strip_Leading Spaces_From_Inget Is separatel procedure Add_Delete_Replace_Line is separate! procedure List is separate: If Str(lepat) : "exit" or Str(Input) . "EXIT" then Flaished 15 True: elsif Ispat . Len 25 4 and (Emput ,Well1 . , 4) . "list" ve lepat , Malt1 .. 1) . "LIST") then elsif Ispat.Len 2 0 and Emput Bul(1) not in 'g' .. "y" then Y then elaif Ispat.Len 3 0 then If Line Man not In 1 .. Max_Line_Minber then Put_Line{"Illegal line number. "): Add_Delete_Replace_Line: exceptlos when Numeric Erroe | Constraint_Error 1} Put_Livet"Line mnber too large. ") End Do_Connand ] parate CLedit. Do_Connand) cocodure Add_Delete_Replace_Line is Imp : Best is Input: " then - Treat "" like "9 x". Delete_First_Character( lmp); Temp UR Head: Find where this mnber belongs in linked list. while Tomp /s mall and thes Tomp.Mext es mull and then If Temp.Next.Min . Line_Js then Temp .Next.Hun C" Line Man loop Bomp Next !" Temp.Mext Rest! - Delete Ilme. Bump 1" Temp. Mext: - Aluance to next link Im list. if lapit Len > 0 then Temp Next 18 new Link' (Line Mon, Inp. Temp.Next); And Delete_Replace_Lisel eparate CLedit. Do_Connand) procedure Delete_First_Character(T 1 in out Text) Is I.Mall! .. T.Lem - 1) :" T.MallZ ., T.Lem): T.Les :s T.Len - 1: Delete First Character; separate (Ledit. Do_Connund) rocedure Get_Lead ing_Integer ( 3 ou4 Meteral? is finni Entoger 18 01 while Imput. Len 3 0 and Emput Wa141) in "of .. '3' loop Aus =" Ama-10 . Character' Pus( Input. Mal[133 -Character Post'0' 3: ' loop Delete_First_Character ( Input): Get_Lead ing_Integer; separate (Led it. bo_Connand) procedure Strip_Leading Spaces_from_Inget is egis while Imput. Len 3 0 and Isput.Walt1] = " Delete_First_Character ( Impat]] end loop: eparate CLadit. Do_Connund) rocedure List is package 110 is vew Integer_20< Integer); wse 100; Start, Finish 1 Meterali Boolean ER Trucs Input.Les Is Inpet.Les - 4! + Delete the name of the connesd. Input.Mal(l .. Input. Lea) :" Input. MallS .. Emput.Len . 4) If Laput-Les . 0 then -- For "LIST" alone, list all Ilmes. atart =" 0: else Fialish 25 Max_Line_Munter . 1: Get_Lead ing_Integer (Start); Get minber after "LIST". If Ispat.Len . 0 thes For "List .". list only lime .. Fleish 1. Start! elsif Ispat. Malt1) es '-' then Else must follow a. Valid 1= False! Delete_First_Character ( Input ): -- Delete the "_". Get_Leading_Integer CFinish]: - Get minber after "-". if Finish . 0 and Start . @ then Valid is False; - "LIST -" Isn't walld. elsit Finish . 0 thes - For "List . - ". list n through end. end 1fl Finish Is Max_Line Number . 11 Halid is Valid and Imput.Len . 0! trailing garbage. if not Valid then Put_Line("Illegal sapatas for LIST. "); = Head .Nexti Skip amsed link at start of linked list. while Temp es mil and then Temp.Men Cs Finish loep If Temp.Min Js Start then Put_Line!" " & Strilemp. Linek !! - Display line B. width 5. - Display text of Ilse. Bomp 1" Temp.Next: mad loopd - Get next Ilak. acegt los when Runerke_Frree | Constraint_Error ? Put_Live("Line manier too large in List. ");